package edu.gdkm.aop;

import edu.gdkm.pojo.Student;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class RecordAspect {
    @Around("edu.gdkm.aop.SystemPointcut.borrowBookPointcut()")
    public Object myAround(ProceedingJoinPoint pjp) throws Throwable {
        Object obj;
        if(((Student)pjp.getArgs()[0]).getBorrowCount()<5){
            obj=pjp.proceed();
        }else{
            obj=false;
        }
        return obj;
    }
}
